# -*- coding: utf-8 -*-
"""
Web framework/Tornado Redirect/test01.py
"""
import tornado.web
import asyncio


class UserHandler(tornado.web.RequestHandler):
    def get(self):
        r_message = "Welcome to UserHandler Get Method."
        self.finish(r_message)


class PhotoHandler(tornado.web.RequestHandler):
    def get(self):
        r_message = "Welcome to PhotoHandler Get Method."
        self.finish(r_message)


class IndexHandler(tornado.web.RequestHandler):
    def get(self):
        self.redirect("/user/")


async def main():
    app = tornado.web.Application([
        (r"/index/", IndexHandler),
        (r"/user/", UserHandler),
        (r"/photo/", PhotoHandler),
        (r"/image/", tornado.web.RedirectHandler, {"url": "/photo/"}),
    ])
    app.listen(8888)
    await asyncio.Event().wait()


if __name__ == '__main__':
    asyncio.run(main())
